<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const target = {
        onlyNumbersGoHere: 0
    };
    const proxy = new Proxy(target, {
        set(target, property, value) {
            if (typeof value !== 'number') {
                return false;
            } else {
                return Reflect.set(...arguments);
            }
        }
    });
    proxy.onlyNumbersGoHere = 1;
    console.log(proxy.onlyNumbersGoHere); // 1 
    proxy.onlyNumbersGoHere = '2'; 
    console.log(proxy.onlyNumbersGoHere); // 1
</script>
</body>
</html>